package com.yh.correct.service.impl;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yh.correct.dao.IRuleBreakMapper;
import com.yh.correct.model.CorrectedPerson;
import com.yh.correct.model.JudicialDeptment;
import com.yh.correct.model.Page;
import com.yh.correct.model.RuleBreak;
import com.yh.correct.service.IRuleBreakService;

/** 
* @author 刘文涛  E-mail: 894516860@qq.com
* @version 创建时间：2017年3月7日 下午 3:31:48
* 违规违纪记录业务层接口实现类
*/
@Service("ruleBreakService")
public class RuleBreakServiceImpl implements IRuleBreakService {
	
	@Autowired
	private IRuleBreakMapper ruleBreakMapper;
	
	@Override
	public Page getLikeRuleBreak(Map<String, Object> condition) {
		Page page=new Page();
		page.setTotalNum(ruleBreakMapper.getLikeRuleBreakCount(condition));
		int pageSize = Integer.parseInt(String.valueOf(condition.get("pageSize")));
		page.setPageSize(pageSize);
		int curPageNum = Integer.parseInt(String.valueOf(condition.get("pageNum")));
		page.setCurPageNum(curPageNum);
		page.setTotalPage(page.getTotalNum()/pageSize+(page.getTotalNum()%pageSize==0?0:1));
		page.setResult(ruleBreakMapper.getLikeRuleBreak(condition));
		return page;
	}

	@Override
	public int addRuleBreak(RuleBreak rulebreak) {
		return ruleBreakMapper.addRuleBreak(rulebreak);
	}

	@Override
	public int delRuleBreak(RuleBreak rulebreak) {
		return ruleBreakMapper.delRuleBreak(rulebreak);
	}

	@Override
	public int updateRuleBreak(RuleBreak rulebreak) {
		return ruleBreakMapper.updateRuleBreak(rulebreak);
	}

	@Override
	public Map<String, Object> getRuleBreakById(RuleBreak rulebreak) {
		return ruleBreakMapper.getRuleBreakById(rulebreak);
	}

	@Override
	public List<JudicialDeptment> getAllUnit() {
		return ruleBreakMapper.getAllUnit();
	}

	@Override
	public List<CorrectedPerson> getNameByUid(Integer id) {
		return ruleBreakMapper.getNameByUid( id);
	}

	@Override
	public List<Map<String,Object>> getAllRuleBreak() {
		// TODO 自动生成的方法存根
		return ruleBreakMapper.getAllRuleBreak();
	}

	@Override
	public List<Map<String, Object>> getRuleBreakTimes() {
		// TODO 自动生成的方法存根
		return ruleBreakMapper.getRuleBreakTimes();
	}

}
